/*

 */
package com.ohos.connent.bizscenecloud.client.modular.device.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ohos.connent.bizscenecloud.client.modular.device.param.ClientDevicesLibraryParam;
import com.ohos.connent.bizscenecloud.client.modular.device.param.ClientScenesLibraryParam;
import com.ohos.connent.bizscenecloud.client.modular.device.result.ClientDevicesLibraryResult;
import com.ohos.connent.bizscenecloud.client.modular.device.result.ClientScenesLibraryResult;
import com.ohos.connent.bizscenecloud.client.modular.device.service.ClientDeviceService;
import com.ohos.connent.bizscenecloud.common.annotation.CommonLog;
import com.ohos.connent.bizscenecloud.common.pojo.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 业务云设备端服务控制器
 **/
@Api(tags = "设备端服务")
@ApiSupport(author = "OHOSCONNECT_TEAM", order = 1)
@RestController
@RequestMapping(value = "/api/v1/business")
@Validated
public class ClientDeviceController {

    @Resource
    private ClientDeviceService clientDeviceService;

    /**
     * 设备库版本升级管理
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation("设备库版本升级管理")
    @CommonLog("设备库版本升级管理")
    @PostMapping("/deviceslibrary-manager")
    public CommonResult<ClientDevicesLibraryResult> devlibVersionManager(@RequestBody @Valid ClientDevicesLibraryParam clientDevicesLibraryParam) {
        return CommonResult.data(clientDeviceService.devlibVersionManager(clientDevicesLibraryParam));
    }

    /**
     * 场景管理库版本升级管理
     */
    @ApiOperationSupport(order = 2)
    @ApiOperation("场景管理库版本升级管理")
    @CommonLog("场景管理库版本升级管理")
    @PostMapping("/sceneslibrary-manager")
    public CommonResult<ClientScenesLibraryResult> scenesLibVersionManager(@RequestBody @Valid ClientScenesLibraryParam clientScenesLibraryParam) {
        return CommonResult.data(clientDeviceService.scenesLibVersionManager(clientScenesLibraryParam));
    }

}
